#ifndef HANDLE_H
#define HANDLE_H

#define SNAKE_VERTICAL			50 
#define SNAKE_HORIZONTAL		40
#define SNAKE_MAX_SNAKE_LENGTH	( SNAKE_VERTICAL * SNAKE_HORIZONTAL )
#define SNAKE_HIGH				  1
#define SNAKE_DOWN				  2
#define SNAKE_LEFT				  3
#define SNAKE_RIGHT				  4
#define SNAKE_BODY          1
#define SNAKE_FIELD_ELEMENT 0
#define SNAKE_FOOD          2

struct coordinates  
{
	int hight;
	int wide;
};

class SNAKE_handle
{
private:
	struct coordinates head;
	int body_elements;
	static int instanceCount;
	char *snake_body	[ SNAKE_MAX_SNAKE_LENGTH ];
	bool feeding( char Snake_field[][SNAKE_VERTICAL] );
	char *food;
	bool check_food(int body, char Snake_field[][SNAKE_VERTICAL], struct coordinates next_food) const;
	void set_food(char Snake_field[][SNAKE_VERTICAL]);
	inline void if_fooding(char Snake_field[][SNAKE_VERTICAL]);
public:
  int is_Snake ( int x, int y, char Snake_field[][SNAKE_VERTICAL] ) const;
	SNAKE_handle(char Snake_field[][SNAKE_VERTICAL]);
	bool self_eat(char Snake_field[][SNAKE_VERTICAL]);
	bool snake_move ( char Snake_field[][SNAKE_VERTICAL] );
	void set_snake ( char Snake_field[][SNAKE_VERTICAL] );
	int last_direction;
};

#endif //HANDLE_H